No.
You need money OR credit. Just one would be enough. Of course, if you had lots of money and plenty of credit you could certainly buy the car.
Sometimes a program has to test if one or the other (or both) of the conditions has been met. Here is how that is done with the car purchase problem:
The symbol ||
(vertical-bar vertical-bar)
means OR.
On your keyboard,
vertical-bar is the top character on the key above the "enter" key.
The OR operator evaluates to true when either qualification is met
or when both are met.
The if
statement asks a question with two parts:
if ( cash >= 25000 || credit >= 25000 )
------------- -------------
cash part credit part
If either part is true, or both parts are true, then the entire boolean expression is true.
Say that you enter 56000 for cash
and 0 for credit
.
What answer (true or false) does each part give you?